<template>
	<view class="liveEnd">
		<c-layout>
		<view class="topBar">

			<u-icon @click="comeBack" name="close" size="34"></u-icon>
		</view>
		<view class="anchorInfo">
			<view class="anchorImg">
				<image :src="$u.file.getMedieUrl(anchorInfo.anchorAvatar)" mode=""></image>
			</view>
			<view class="anchorName">
				{{anchorInfo.anchorName?anchorInfo.anchorName:''}}
			</view>
			<view class="anchorTitle">
				{{$t('liveBar.liveEnd')}}
			</view>
			<view class="anchorNum">
				{{$t('liveBar.people_number')}} {{anchorInfo.viewsNumber}}
			</view>
		</view>
		<view class="mainTitle">
			{{$t('liveBar.guess_like')}}
		</view>
		<view class="main">
			<view class="main_List" v-for="(item,index) in LivingList" :key="index" @click="ToLiveRoom(item)">
				<view class="main_Content">
					<image class="main_Img" :src="$u.file.getMedieUrl(item.avatar)" mode="aspectFill"></image>
					<view class="liveStatus">
						<image class="isLiving" src="../../static/images/video/Path_1525.png" mode=""></image>	
						<text class="liveText">{{$t('liveBar.living')}}</text>
					</view>
					<view class="main_Intro">
						<text class="liveName">{{item.anchorName}}</text>
						<view class="main_Hot">
							<image class="fire" src="../../static/images/video/fire.png" mode=""></image>
							<text class="main_Count">{{item.fans}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		</c-layout>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				LivingList:'',
				anchorInfo:''
			}
		},
		onLoad(option) {
			//猜你喜欢列表
			this.$u.post("/app/anchor/lives/room/getAnchorLivesRoom").then(res => {
				console.log('直播间列表', res.data.records)
				this.LivingList = res.data.records.filter(item=>item.liveStatus==2)
			}),
			//结束直播获取主播信息
			this.$u.get(`/app/anchor/lives/settlementData/${option.anchorSessionId}`).then(res=>{
				this.anchorInfo=res.data
			})
		},
		methods: {
			ToLiveRoom(data){
				uni.publicJS.intoPlayer({...data,userName:data.nickName})
			},

			//返回上一页
			comeBack(){
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.liveEnd{
		.topBar{
			box-sizing: border-box;
			display: flex;
			justify-content: end;
			padding: 106rpx 32rpx;
		}
		.anchorInfo{
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 110rpx; 	
			.anchorImg{
				width: 136rpx;
				height: 136rpx;
				border-radius: 50%;
				image{
					width: 100%;
					height: 100%;
					border-radius: 50%;
				}
			}
			.anchorName{
				height: 56rpx;
				font-size: 36rpx;
				font-family: HarmonyOS Sans SC-Regular, HarmonyOS Sans SC;
				font-weight: 400;
				color: #212121;
				line-height: 56rpx;
			}
			.anchorTitle{
				height: 56rpx;
				font-size: 36rpx;
				font-family: HarmonyOS Sans SC-Regular, HarmonyOS Sans SC;
				font-weight: 400;
				color: #212121;
				line-height: 56rpx;
			}
			.anchorNum{
				text-align: center;
				height: 56rpx;
				font-size: 28rpx;
				font-family: HarmonyOS Sans SC-Regular, HarmonyOS Sans SC;
				font-weight: 400;
				color: #666666;
				line-height: 56rpx;
			}
		}
		.mainTitle{
			height: 56rpx;
			font-size: 36rpx;
			font-family: HarmonyOS Sans SC-Regular, HarmonyOS Sans SC;
			font-weight: 400;
			color: #212121;
			line-height: 56rpx;
			padding: 0 40rpx;
			margin-top: 60rpx;
		}
		.main {
			padding: 0 31rpx;
			margin-top: 32rpx;
			display: flex;
			flex-wrap: wrap;
			.main_List {
				width: 326rpx;
				height: 364rpx;
				border-radius: 24rpx;
				opacity: 1;
				margin: 20rpx 9rpx 0;
				.main_Content {
					width: 100%;
					height: 100%;
					display: flex;
					justify-content: space-between;
					position: relative;
					.main_Img {
						border-radius: 24rpx;
						width: 100%;
						height: 100%;
					}
					.liveStatus{
						position: absolute;
						top: 20rpx;
						left: 20rpx;
						display: flex;
						.isLiving{
							width: 34rpx;
							height: 24rpx;
						}
						.liveText{
							margin-left: 20rpx;
							height: 26rpx;
							font-size: 24rpx;
							font-family: HarmonyOS Sans SC-Regular, HarmonyOS Sans SC;
							font-weight: 400;
							color: #FFFFFF;
							line-height: 26rpx;
						}
					}
					
					.main_Intro {
						height: 100%;
						width: 100%;
						position: absolute;
						padding: 22rpx 20rpx;
						display: flex;
						align-items: flex-end;
						.liveName {
							width: 72rpx;
							height: 34rpx;
							font-size: 24rpx;
							font-weight: 400;
							color: #FFFFFF;
							line-height: 34rpx;
							flex: 1;
							text-align: center;
						}
						.main_Hot {
							// margin-top: 100%;
							text-align: center;
							width: 120rpx;
							height: 50rpx;
							background: rgba(0, 0, 0, 0.55);
							border-radius: 60rpx;
							opacity: 1;
							display: flex;
							justify-content: space-evenly;
							align-items: center;
							.fire{
								width: 28rpx;
								height: 30rpx;
							}
							.main_Count {
								width: 40rpx;
								height: 34rpx;
								font-size: 24rpx;
								font-weight: 400;
								color: #FFFFFF;
								line-height: 34rpx;
							}
						}
					}
		
				}
		
			}
		}
	}
</style>
